package com.example.qq.Old_Login;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.qq.music.Musci;
import com.example.qq.R;
import com.example.qq.download.xiazai;
import com.example.qq.gps.Gps;

public class UI extends AppCompatActivity  {
    private EditText editText, editText1;
    private Button button,button1,button2,button3,button4;

    @Override
//    public void onClick(View view) {
//        Intent intent = new Intent(UI.this, UI.class);
//        switch (view.getId()) {
//            case R.id.denglu:
//                startActivity(intent);
//                Toast.makeText(UI.this, "登陆成功！", Toast.LENGTH_LONG).show();
//            case R.id.zhuce:
//            case R.id.wangjimima:
//            default:
//        }
//    }

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ui);
        ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
        editText = (EditText)findViewById(R.id.zhanghao);
        editText1 =(EditText)findViewById(R.id.mima);
        button = (Button) findViewById(R.id.denglu);
        button.getBackground().setAlpha(125);
        button = (Button)findViewById(R.id.denglu);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String Zhanghao,Mima;
                Zhanghao = editText.getText().toString();
                Mima      = editText1.getText().toString();
                if(Zhanghao.equals("Admin") &&  Mima.equals("123")){
                    Toast.makeText(UI.this, "登陆成功！", Toast.LENGTH_SHORT ).show();
                }
                else if(Zhanghao.equals("Admin") &&  Mima.equals("1234"))
                {
                    Toast.makeText(UI.this, "登陆成功！", Toast.LENGTH_SHORT ).show();
                    Intent intent = new Intent(UI.this,Musci.class);
                    startActivity(intent);
                } else if(Zhanghao.equals("Admin") &&  Mima.equals("12"))
                {
                    Toast.makeText(UI.this, "登陆成功！", Toast.LENGTH_SHORT ).show();
                    Intent intent = new Intent(UI.this,xiazai.class);
                    startActivity(intent);
                }
//                else if(Zhanghao.equals("Admin") &&  Mima.equals("12345"))
//                {
//                    Toast.makeText(UI.this, "登陆成功！", Toast.LENGTH_SHORT ).show();
//                    Intent intent = new Intent(UI.this,Web.class);
//                    startActivity(intent);
//                }
                else if (Zhanghao.equals("") &&  Mima.equals(""))
                {
                    Toast.makeText(UI.this, "你还没填账号或者密码啊！", Toast.LENGTH_SHORT ).show();
                }
                else if(Zhanghao.equals("Admin") &&  Mima.equals("12345"))
                {
                    Toast.makeText(UI.this, "登陆成功！", Toast.LENGTH_SHORT ).show();
                    Intent intent = new Intent(UI.this,Gps.class);
                    startActivity(intent);
                }
                else
                    Toast.makeText(UI.this, "密码或者账号错误了!", Toast.LENGTH_SHORT ).show();


            }
        });
        button1 = (Button)findViewById(R.id.zhuce);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://qm.qq.com/cgi-bin/qm/qr?k=oioUF3w_j-TX0dFmelUQFYIokBAS1BNL)"));
                startActivity(intent);
            }
        });
        button2 = (Button)findViewById(R.id.wangjimima);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(Uri.parse("http://qm.qq.com/cgi-bin/qm/qr?k=oioUF3w_j-TX0dFmelUQFYIokBAS1BNL)"));
                startActivity(intent);
            }
        });
        button3 = (Button)findViewById(R.id.help);
        button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_DIAL);
                intent.setData(Uri.parse("tel:15319957093"));
                startActivity(intent);
            }
        });
        button4 = (Button)findViewById(R.id.fuwutiaokuan);

    }
}


